Release 10.1A: OpenEdge Development:
Programming Interfaces
Shared library parameter data types
For shared library parameter definitions, Progress provides a special set of data types to match the standard C data types used in shared library calling sequences. These are the only data types you can specify for the AS
datatypeoption in shared library parameter definitions:
CHARACTERandMEMPTRare standard Progress variable data types available for other uses. You can only use the remaining listed data types for shared library parameter definitions.The
MEMPTRdata type specifies a pointer to a region of memory. It lets you define and pass C-compatible structures to shared library routines. For more information on using theMEMPTRdata type, see the "Using structure parameters" section.Data type compatibilities
For each parameter definition, you must specify a data type that is compatible with the standard C data type of the corresponding DLL routine parameter. Many data types referenced by DLL routines have the same memory size and usage.
Table 12–2 lists each supported memory size and usage, examples of corresponding C data types, and the Progress DLL parameter data type you must use for each one.
Table 12–2: C and DLL parameter data type compatibilities Example Cdata type DLL parameterdata type Data type sizeand usage 8-bit unsigned integer 16-bit signed integer 16-bit unsigned integer long, int1 LONG2 32-bit signed integer 4-byte floating point 8-byte floating point Address (usually 32 bits)c-data-type3 HANDLE TOparameter-data-type3 Address (usually 32 bits)char*,output-pointer(which can bechar**,short**, and so on), or a pointer to a structure. Address (usually 32 bits)
1The C data typeintgenerally specifies a size that depends on the operating system.2To pass a NULL pointer value to a DLL routine, pass 0 using aLONGparameter. Do not use a nullMEMPTRvariable to pass a NULL value. If this conflicts with another way to call the DLL routine, specify a second declaration for the same routine using theORDINALoption of thePROCEDUREstatement.3You can use theHANDLETOoption to specify a pointer to a scalar type. Therefore, you can use theHANDLETOoption with the parameter data types (that is,BYTE,SHORT,UNSIGNED-SHORT,LONG,FLOAT, andDOUBLE) in order to specify a pointer to the respective C data types (that is, char, short, unsigned short, long, int, float, and double). ForCHARACTERandMEMPTRparameters, it is redundant because this data type is always passed using a pointer (char*).
To indicate that the DLL or UNIX shared library parameter is a pointer to a value rather than the value itself, use the
HANDLEoption. TheHANDLEoption is required when the DLL routine expects a pointer to the value. Note that theCHARACTERdata type implies theHANDLEoption, whether or not you specify it. TheTOkeyword aids readability but has no meaning.For more information on C data types, see the documentation for the operating system(s) on which your applications will run.
Other data type options
For shared library parameters that pass pointers to scalar values (for example,
SHORT,DOUBLE, etc.), Progress provides theHANDLEoption. You must use this option forINPUTparameters that require pointers to scalar values instead of the values themselves. Although Progress automatically passes pointers forOUTPUTandINPUT-OUTPUTparameters, theHANDLEoption is recommended for clarity.If you use the
Note: Progress does not support database fields defined asLIKEoption to specify the data type of a parameter definition,fieldmight only be a database field defined asCHARACTERor a Progress variable defined asCHARACTERorMEMPTR.MEMPTR.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |